<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="jakarta.tags.core" %>
<%@ taglib prefix="fmt" uri="jakarta.tags.fmt" %>

<div class="admin-table">
    <table>
        <thead>
            <tr>
                <th>ID</th>
                <th>用户</th>
                <th>情侣</th>
                <th>评论内容</th>
                <th>点赞数</th>
                <th>创建时间</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            <c:forEach items="${comments}" var="comment">
                <tr>
                    <td>${comment.id}</td>
                    <td>${empty comment.username ? '已注销用户' : comment.username}</td>
                    <td>
                        <a href="/couples/${comment.couple_id}" target="_blank">
                            ${comment.lover1_name} & ${comment.lover2_name}
                        </a>
                    </td>
                    <td>${comment.content}</td>
                    <td>${comment.likes}</td>
                    <td>${comment.formatted_create_time}</td>
                    <td>
                        <button type="button" class="btn-small btn-danger" onclick="deleteComment(${comment.id})">删除</button>
                    </td>
                </tr>
            </c:forEach>
        </tbody>
    </table>
</div>

<script src="/static/js/admin-comments.js"></script> 